package tronglv.gs.control;

import org.andengine.engine.Engine;
import org.andengine.engine.camera.ZoomCamera;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.texture.region.TiledTextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import tronglv.gs.model.ResourcesLoader;
import vn.freestore.blankApp01.MainApp;

public class ResourcesManager {
	private static final ResourcesManager INSTANCE = new ResourcesManager();
	public Engine engine;
	public MainApp activity;
	public ZoomCamera camera;
	public VertexBufferObjectManager vbom;
	// flash

	public ITextureRegion flash_logo_region;
	// menu
	public ITextureRegion menu_bg_region, menu_btnplay_region;
	public TiledTextureRegion menu_sound_region, menu_music_region;

	// title & time
	public ITextureRegion title_separator_region, level_time_process_region,
			level_process_region, best_score_region, score_region;

	// animation
	public TiledTextureRegion lightting_jewel_region, normal_score_region,
			normal_score_effect_region, timer_jewel_region, combo_region,
			eliminate_column_region, eliminate_row_region,
			eliminate_lighting_region, fire_region, eliminate_blue_region,
			eliminate_green_region, eliminate_red_region,
			eliminate_yellow_region, eliminate_oranges_region,
			eliminate_purple_region;

	public ITextureRegion play_bg_region, play_frame_region,
			play_chessBoard_region, play_timer_region, play_title_region;

	public TiledTextureRegion jewelPurple_region, jewelGreen_region,
			jewelRed_region, jewelBlue_region, jewelYellow_region,
			jewelOranges_region, play_select_region, pause_region;

	public static void prepareManager(Engine engine, MainApp activity,
			ZoomCamera camera, VertexBufferObjectManager vbom) {
		getInstance().engine = engine;
		getInstance().activity = activity;
		getInstance().camera = camera;
		getInstance().vbom = vbom;
	}

	public static ResourcesManager getInstance() {
		return INSTANCE;
	}

	public void loadFlash() {
		flash_logo_region = ResourcesLoader.loadResources("logo_company.png");
	}

	public void loadMenu() {

		menu_bg_region = ResourcesLoader
				.loadResources("play/ic_background.jpg");

		menu_btnplay_region = ResourcesLoader
				.loadResources("play/ic_timer.png");

		menu_music_region = ResourcesLoader.loadTileResources(
				"play/ic_music.png", 2, 1);

		menu_sound_region = ResourcesLoader.loadTileResources(
				"play/ic_sound.png", 2, 1);

	}

	public void loadAnim() {
		eliminate_green_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel_eliminate_1.png", 3, 2);
		eliminate_red_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel_eliminate_2.png", 3, 2);
		eliminate_blue_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel_eliminate_3.png", 3, 2);
		eliminate_yellow_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel_eliminate_4.png", 3, 2);
		eliminate_purple_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel_eliminate_5.png", 3, 2);
		eliminate_oranges_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel_eliminate_6.png", 3, 2);

		eliminate_lighting_region = ResourcesLoader.loadTileResources(
				"play/ic_eliminate_lighting.png", 4, 1);
		eliminate_green_region = ResourcesLoader.loadTileResources(
				"play/ic_eliminate_row_animation.png", 1, 4);
		eliminate_green_region = ResourcesLoader.loadTileResources(
				"play/ic_eliminate_column_animation.png", 4, 1);

		fire_region = ResourcesLoader.loadTileResources(
				"play/ic_fire_jewel_animation.png", 3, 3);
		combo_region = ResourcesLoader.loadTileResources(
				"play/ic_combo_animation.png", 3, 5);
		timer_jewel_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel_eliminate_1.png", 4, 3);
		normal_score_region = ResourcesLoader.loadTileResources(
				"play/ic_normal_score.png", 5, 3);
		normal_score_effect_region = ResourcesLoader.loadTileResources(
				"play/ic_normal_score_effect.png", 5, 3);

	}

	public void loadPlay() {

		play_bg_region = ResourcesLoader
				.loadResources("play/ic_timer_scene_bg.jpg");

		play_chessBoard_region = ResourcesLoader
				.loadResources("play/ic_game_chessboard.png");

		play_select_region = ResourcesLoader.loadTileResources(
				"play/ic_selection_border.png", 2, 1);
		level_time_process_region = ResourcesLoader
				.loadResources("play/ic_leveltime.png");

		title_separator_region = ResourcesLoader
				.loadResources("play/ic_title_separator.png");
		best_score_region = ResourcesLoader
				.loadResources("play/ic_best_score.png");
		score_region = ResourcesLoader.loadResources("play/ic_title_score.png");
		pause_region = ResourcesLoader.loadTileResources(
				"play/ic_game_pause.png", 1, 2);
		level_process_region = ResourcesLoader
				.loadResources("play/ic_progress_bg.png");

		jewelPurple_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel5.png", 3, 4);
		jewelBlue_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel3.png", 3, 4);
		jewelGreen_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel1.png", 3, 4);
		jewelOranges_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel6.png", 3, 4);
		jewelRed_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel2.png", 3, 4);
		jewelYellow_region = ResourcesLoader.loadTileResources(
				"play/ic_jewel4.png", 3, 4);

	}

}
